$(function(){
	$('.imageShow').each(function(){
		var $frame = $(this), 
			$showImage = $frame.find('.show-image');

		$frame.find('.smallImage a').mouseover(function(){
			var $this = $(this), 
				_src = $this.attr('data-image-url');

			if($showImage.attr('src') != _src){
				$showImage.hide().attr('src', _src).stop(false, true).fadeTo(400, 1);
			}
		});
	});

	$("#myCarousel img").each(function(){
		$(this).click(function(){
			var openUrl = $(this).attr('blank-url');
			window.open(openUrl);
		});
	});
	
	(function() {
	    var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
	        .text($backToTopTxt).attr("title", $backToTopTxt).click(function() {
	            $("html, body").animate({ scrollTop: 0 }, 120);
	    }), $backToTopFun = function() {
	        var st = $(document).scrollTop(), winh = $(window).height();
	        (st > 0)? $backToTopEle.show(): $backToTopEle.hide();    
	        //IE6下的定位
	        if (!window.XMLHttpRequest) {
	            $backToTopEle.css("top", st + winh - 166);    
	        }
	    };
	    $(window).bind("scroll", $backToTopFun);
	    $(function() { $backToTopFun(); });
	})();
	
	(function() {
		var trackids = $("#J_TrackIds")[0].value;
		if(trackids){
			TOP.api('rest', 'get', {
				method : 'taobao.taobaoke.widget.items.convert',
				nick : '陈丽_chris',
				num_iids : trackids,
				fields : 'num_iid,click_url'
			}, function(resp) {
				if (resp.error_response) {
					alert("error"+resp.error_response.msg);
					return false;
				}
				var respItem = resp.taobaoke_items.taobaoke_item;
				for(var i = 0; i < respItem.length; i++) {
					$("#image_a_" + respItem[i].num_iid).attr("href", respItem[i].click_url);
					$("#detail_a_" + respItem[i].num_iid).attr("href", respItem[i].click_url);
				}
			})
		}
	})();
	
});


